from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import RGBColor,Pt

doc = Document()

title = doc.add_paragraph('这是标题', style='Heading 1')
title.paragraph_format.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = title.runs[0]
run.font.color.rgb = RGBColor(255, 0, 0)
run.font.size = Pt(36)

doc.add_paragraph('这是段落')

doc.save('test.docx')

